import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: "/layout" },
  {
    path: "/layout",
    name: "layout",
    component: () => import("../layout/index.vue"),
    // layout的二级路由
    children: [
      {
        //二级路由默认加载主页
        path: "/",
        name: "home",
        component: () => import("../views/home/index.vue"),
      },
      {
        //管理员
        path: "admin",
        name: "admin",
        component: () => import("../views/admin/index.vue"),
      },
      {
        // 学员
        path: "student",
        name: "student",
        component: () => import("../views/student/index.vue"),
      },
      {
        //课程添加
        path: "courseadd",
        name: "courseadd",
        component: () => import("../views/courseAdd/index.vue"),
      },
      {
        // 视频模块
        path: "videolist",
        name: "videolist",
        component: () => import("../views/video/index.vue"),
      },
      {
        //课程列表模块
        path: "courselist",
        name: "courselist",
        component: () => import("../views/courseList/index.vue"),
      },
      {
        //测试二次封装的表格
        path: "test",
        name: "test",
        component: () => import("../views/Test/index.vue"),
      },
      {
        //测试二次封装的表格
        path: "vip",
        name: "vip",
        component: () => import("../views/vip/vip.vue"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("../views/login/index.vue"),
  },
];

const router = new VueRouter({
  mode: "hash",
  base: process.env.BASE_URL,
  routes,
});

export default router;
